/**
*  struct ListNode {
*        int val;
*        struct ListNode *next;
*        ListNode(int x) :
*              val(x), next(NULL) {
*        }
*  };
*/
#include <vector>
class Solution {
public:
    vector<int> printListFromTailToHead(struct ListNode* head) {
    	vector<int> v,t;
        while(head)
        {
        	v.push_back(head->val);
        	head = head->next;
        }
        while(!v.empty())
        {
        	t.push_back(v.back());
        	v.pop_back();
        }
        return t;
    }
};